#include <stdio.h>  
#include <mysql/mysql.h>  
#include <string.h>  
void insert_subject(MYSQL *mysql)
{  
	printf("        2.插入课程表数据        \n"); 
	char  data[200];  
	int   f;  
	int id,source;
	char sub[50];
	printf("输入课程的ID号，名称，学分:");
	scanf("%d %s %d",&id,sub,&source);
	sprintf(data,"insert into subject (id,sub,source) values ('%d','%s','%d')",id,sub,source);
	f = mysql_real_query(mysql, data, strlen(data));  
	if (0 != f) 
	{  
		printf("插入失败\n");  
	}
	else
	{
		printf("插入成功\n");
	}
}	
